<!-- 通用页面加载组件 -->
<template>
  <div class="page-loading-container" :class="{ overlay: overlay }">
    <div class="loading-content">
      <van-loading :color="color" :size="size" :vertical="true">
        {{ text }}
      </van-loading>
    </div>
  </div>
</template>

<script setup>
import { defineProps } from 'vue';

const props = defineProps({
  // 加载文字说明
  text: {
    type: String,
    default: '加载中...'
  },
  // 加载图标颜色
  color: {
    type: String,
    default: 'var(--primary-color)'
  },
  // 加载图标尺寸
  size: {
    type: String,
    default: '24px'
  },
  // 是否显示为覆盖层
  overlay: {
    type: Boolean,
    default: false
  }
});
</script>

<style scoped>
.page-loading-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 120px;
}

.page-loading-container.overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: 100;
  min-height: 100%;
}

.loading-content {
  text-align: center;
}
</style> 